package com.dao;

import com.entity.TTag;
import com.entity.TTagExample;
import com.mapper.TTagMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by del on 16-5-1.
 */
@Component
public class TTagDao {

    @Autowired
    private TTagMapper tTagMapper;

    public boolean insert(TTag tTag){
        return tTagMapper.insert(tTag) == 1;
    }

    public boolean delete(Integer id){
        return tTagMapper.deleteByPrimaryKey(id) == 1;
    }

    public TTag update(TTag tTag){
        return tTagMapper.updateByPrimaryKey(tTag) == 1 ? tTag : null;
    }

    public TTag select(Integer id){
        return tTagMapper.selectByPrimaryKey(id);
    }

    public List<TTag> selectByExample(TTagExample tTagExample) {
        return tTagMapper.selectByExample(tTagExample);
    }
}
